import requests from "@/utils/request";

const state = {
  shopList: [],
};
const mutations = {
  GETSHOPCART(staet, list) {
    state.shopList = list;
  },
};
const actions = {
  // 获取购物车数据
  async getShopCart({ state, commit, dispatch }) {
    let result = await requests({ url: `/api/cart/cartList`, method: "get" });

    commit("GETSHOPCART", result.data[0]?.cartInfoList);
  },
  //  requests({ url: `/cart/addToCart/${skuId}/${skuNum}`, method: "post" });
  // 修改购物车商品数量
  // async modifyNum() {
  //   requests({ url: `/cart/addToCart/${skuId}/${skuNum}`, method: "post" });
  // },
};
const getters = {};
export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters,
};
